const Mock = require('mockjs');

/**
 * 法律服务机构
 */
function getLegalServiceAgencyList () {
  const { Random } = Mock;
  let list = [];
  let randomNumber = Math.ceil(Math.random() * 20);
  for (let i = 0; i < randomNumber; i++) {
    let item = Mock.mock({
      'GuidLegalServiceAgency': Random.guid(),
      'Name': `${Random.province()}${Random.cword(3, 5)}律师事务所`,
      'Description': Random.cword(15, 30),
      'Picture|1': [
        'https://xwsf.wusuo.xin/uploads/20180523/5b04d177ef0e4.jpg'
      ] 
    })
    list.push(item);
  }

  return list;
}

function getLegalServiceAgencyInfo (guidLegalServiceAgency) {
  const { Random } = Mock;
  return Mock.mock({
    'GuidLegalServiceAgency': guidLegalServiceAgency,
    'Name': `${Random.province()}${Random.cword(3, 5)}律师事务所`,
    'Description|1': [
      `<p>${Random.paragraph()}</p>`,
      `<p>${Random.paragraph(1, 3)}</p>`,
      `<p>${Mock.mock('@paragraph(1, 3)')}</p>`,
    ],
    'Picture|1': [
      `${Random.url('https')}/${Random.last()}.jpg`,
      `${Random.url('https')}/${Random.last()}.png`,
      `${Random.url('https')}/${Random.last()}.jpeg`
    ]
  })
}

module.exports = {
  getLegalServiceAgencyList,
  getLegalServiceAgencyInfo
}